/**
 */
package org.xtext.example.mydsl.componentBasedSoftwareDevelopment.impl;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

import org.xtext.example.mydsl.componentBasedSoftwareDevelopment.ComponentActionStatement;
import org.xtext.example.mydsl.componentBasedSoftwareDevelopment.ComponentBasedSoftwareDevelopmentPackage;
import org.xtext.example.mydsl.componentBasedSoftwareDevelopment.ComponentBetweenConstraint;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Component Between Constraint</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.xtext.example.mydsl.componentBasedSoftwareDevelopment.impl.ComponentBetweenConstraintImpl#getMiddleAction <em>Middle Action</em>}</li>
 *   <li>{@link org.xtext.example.mydsl.componentBasedSoftwareDevelopment.impl.ComponentBetweenConstraintImpl#getBeforeAction <em>Before Action</em>}</li>
 *   <li>{@link org.xtext.example.mydsl.componentBasedSoftwareDevelopment.impl.ComponentBetweenConstraintImpl#getAfterAction <em>After Action</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ComponentBetweenConstraintImpl extends ComponentStatementImpl implements ComponentBetweenConstraint
{
  /**
   * The cached value of the '{@link #getMiddleAction() <em>Middle Action</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getMiddleAction()
   * @generated
   * @ordered
   */
  protected ComponentActionStatement middleAction;

  /**
   * The cached value of the '{@link #getBeforeAction() <em>Before Action</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getBeforeAction()
   * @generated
   * @ordered
   */
  protected ComponentActionStatement beforeAction;

  /**
   * The cached value of the '{@link #getAfterAction() <em>After Action</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getAfterAction()
   * @generated
   * @ordered
   */
  protected ComponentActionStatement afterAction;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected ComponentBetweenConstraintImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return ComponentBasedSoftwareDevelopmentPackage.Literals.COMPONENT_BETWEEN_CONSTRAINT;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public ComponentActionStatement getMiddleAction()
  {
    return middleAction;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetMiddleAction(ComponentActionStatement newMiddleAction, NotificationChain msgs)
  {
    ComponentActionStatement oldMiddleAction = middleAction;
    middleAction = newMiddleAction;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ComponentBasedSoftwareDevelopmentPackage.COMPONENT_BETWEEN_CONSTRAINT__MIDDLE_ACTION, oldMiddleAction, newMiddleAction);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setMiddleAction(ComponentActionStatement newMiddleAction)
  {
    if (newMiddleAction != middleAction)
    {
      NotificationChain msgs = null;
      if (middleAction != null)
        msgs = ((InternalEObject)middleAction).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ComponentBasedSoftwareDevelopmentPackage.COMPONENT_BETWEEN_CONSTRAINT__MIDDLE_ACTION, null, msgs);
      if (newMiddleAction != null)
        msgs = ((InternalEObject)newMiddleAction).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ComponentBasedSoftwareDevelopmentPackage.COMPONENT_BETWEEN_CONSTRAINT__MIDDLE_ACTION, null, msgs);
      msgs = basicSetMiddleAction(newMiddleAction, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ComponentBasedSoftwareDevelopmentPackage.COMPONENT_BETWEEN_CONSTRAINT__MIDDLE_ACTION, newMiddleAction, newMiddleAction));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public ComponentActionStatement getBeforeAction()
  {
    return beforeAction;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetBeforeAction(ComponentActionStatement newBeforeAction, NotificationChain msgs)
  {
    ComponentActionStatement oldBeforeAction = beforeAction;
    beforeAction = newBeforeAction;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ComponentBasedSoftwareDevelopmentPackage.COMPONENT_BETWEEN_CONSTRAINT__BEFORE_ACTION, oldBeforeAction, newBeforeAction);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setBeforeAction(ComponentActionStatement newBeforeAction)
  {
    if (newBeforeAction != beforeAction)
    {
      NotificationChain msgs = null;
      if (beforeAction != null)
        msgs = ((InternalEObject)beforeAction).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ComponentBasedSoftwareDevelopmentPackage.COMPONENT_BETWEEN_CONSTRAINT__BEFORE_ACTION, null, msgs);
      if (newBeforeAction != null)
        msgs = ((InternalEObject)newBeforeAction).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ComponentBasedSoftwareDevelopmentPackage.COMPONENT_BETWEEN_CONSTRAINT__BEFORE_ACTION, null, msgs);
      msgs = basicSetBeforeAction(newBeforeAction, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ComponentBasedSoftwareDevelopmentPackage.COMPONENT_BETWEEN_CONSTRAINT__BEFORE_ACTION, newBeforeAction, newBeforeAction));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public ComponentActionStatement getAfterAction()
  {
    return afterAction;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetAfterAction(ComponentActionStatement newAfterAction, NotificationChain msgs)
  {
    ComponentActionStatement oldAfterAction = afterAction;
    afterAction = newAfterAction;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ComponentBasedSoftwareDevelopmentPackage.COMPONENT_BETWEEN_CONSTRAINT__AFTER_ACTION, oldAfterAction, newAfterAction);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setAfterAction(ComponentActionStatement newAfterAction)
  {
    if (newAfterAction != afterAction)
    {
      NotificationChain msgs = null;
      if (afterAction != null)
        msgs = ((InternalEObject)afterAction).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ComponentBasedSoftwareDevelopmentPackage.COMPONENT_BETWEEN_CONSTRAINT__AFTER_ACTION, null, msgs);
      if (newAfterAction != null)
        msgs = ((InternalEObject)newAfterAction).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ComponentBasedSoftwareDevelopmentPackage.COMPONENT_BETWEEN_CONSTRAINT__AFTER_ACTION, null, msgs);
      msgs = basicSetAfterAction(newAfterAction, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ComponentBasedSoftwareDevelopmentPackage.COMPONENT_BETWEEN_CONSTRAINT__AFTER_ACTION, newAfterAction, newAfterAction));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case ComponentBasedSoftwareDevelopmentPackage.COMPONENT_BETWEEN_CONSTRAINT__MIDDLE_ACTION:
        return basicSetMiddleAction(null, msgs);
      case ComponentBasedSoftwareDevelopmentPackage.COMPONENT_BETWEEN_CONSTRAINT__BEFORE_ACTION:
        return basicSetBeforeAction(null, msgs);
      case ComponentBasedSoftwareDevelopmentPackage.COMPONENT_BETWEEN_CONSTRAINT__AFTER_ACTION:
        return basicSetAfterAction(null, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case ComponentBasedSoftwareDevelopmentPackage.COMPONENT_BETWEEN_CONSTRAINT__MIDDLE_ACTION:
        return getMiddleAction();
      case ComponentBasedSoftwareDevelopmentPackage.COMPONENT_BETWEEN_CONSTRAINT__BEFORE_ACTION:
        return getBeforeAction();
      case ComponentBasedSoftwareDevelopmentPackage.COMPONENT_BETWEEN_CONSTRAINT__AFTER_ACTION:
        return getAfterAction();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case ComponentBasedSoftwareDevelopmentPackage.COMPONENT_BETWEEN_CONSTRAINT__MIDDLE_ACTION:
        setMiddleAction((ComponentActionStatement)newValue);
        return;
      case ComponentBasedSoftwareDevelopmentPackage.COMPONENT_BETWEEN_CONSTRAINT__BEFORE_ACTION:
        setBeforeAction((ComponentActionStatement)newValue);
        return;
      case ComponentBasedSoftwareDevelopmentPackage.COMPONENT_BETWEEN_CONSTRAINT__AFTER_ACTION:
        setAfterAction((ComponentActionStatement)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case ComponentBasedSoftwareDevelopmentPackage.COMPONENT_BETWEEN_CONSTRAINT__MIDDLE_ACTION:
        setMiddleAction((ComponentActionStatement)null);
        return;
      case ComponentBasedSoftwareDevelopmentPackage.COMPONENT_BETWEEN_CONSTRAINT__BEFORE_ACTION:
        setBeforeAction((ComponentActionStatement)null);
        return;
      case ComponentBasedSoftwareDevelopmentPackage.COMPONENT_BETWEEN_CONSTRAINT__AFTER_ACTION:
        setAfterAction((ComponentActionStatement)null);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case ComponentBasedSoftwareDevelopmentPackage.COMPONENT_BETWEEN_CONSTRAINT__MIDDLE_ACTION:
        return middleAction != null;
      case ComponentBasedSoftwareDevelopmentPackage.COMPONENT_BETWEEN_CONSTRAINT__BEFORE_ACTION:
        return beforeAction != null;
      case ComponentBasedSoftwareDevelopmentPackage.COMPONENT_BETWEEN_CONSTRAINT__AFTER_ACTION:
        return afterAction != null;
    }
    return super.eIsSet(featureID);
  }

} //ComponentBetweenConstraintImpl
